package com.junko.api.controller;

import com.junko.api.annotation.UserAccess;
import com.junko.model.app.User;
import com.junko.service.app.IUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/api/user")
@Api(value = "用户")
public class UserCtrl extends BaseApiController{
    private Logger logger = LogManager.getLogger(UserCtrl.class);

    @Resource
    private IUserService userService;

    @ApiOperation(httpMethod = "GET", value = "获取资料")
    @GetMapping("/info")
    @UserAccess
    public User info(){
        return userService.selectByPrimaryKey(getCurrentUserId());
    }
}